home *** CD-ROM | disk | FTP | other *** search
/ Workbench Design / WB Collection.iso / workbench werkzeuge / icon tools / forceicon / source / forceicon.h < prev    next >
Text File  |  1996-04-07  |  18KB  |  445 lines

  1. /*
  2. Auto:        smake ForceIcon
  3. */
  4.  
  5.  
  6. /* $Revision Header built automatically *************** (do not edit) ************
  7. **
  8. ** © Copyright by GuntherSoft
  9. **
  10. ** File             : SnakeSYS:CPrgs/Utils/ForceIcon/ForceIcon.h
  11. ** Created on       : Wednesday, 20.10.93 17:19:27
  12. ** Created by       : Kai Iske
  13. ** Current revision : V1.8
  14. **
  15. **
  16. ** Purpose
  17. ** -------
  18. **   - ForceIcon Header file
  19. **
  20. ** Revision V1.8
  21. ** --------------
  22. ** created on Donnerstag, 26.01.95 15:55:41  by  Kai Iske.   LogMessage :
  23. **  -*-  changed on Donnerstag, 26.01.95 16:09:33  by  Kai Iske.   LogMessage :
  24. **   - Added NewIcons icons for both programs.
  25. **     (Submitted and converted by : Joachim Worringen. Thanks)
  26. **  -*-  changed on Donnerstag, 26.01.95 16:01:30  by  Kai Iske.   LogMessage :
  27. **   - Improved way of determining whether an old (Non-AppIcon-
  28. **     Supporting) version of FIcon is running, as it seems the
  29. **     other method didn`t work on WB 2.x systems.
  30. **     (Reported by : Michael Barsoom)
  31. **  -*-  created on Donnerstag, 26.01.95 15:55:41  by  Kai Iske.   LogMessage :
  32. **   - Sigh, one small, simple bug made ForceIcon unusable in
  33. **     conjunction with ToolManager. (Should write D0,-(sp) instead
  34. **     of D2,-(sp) next time)
  35. **     (Reported by : Well, too many. This way you get an
  36. **     impression, how many people are using ForceIcon ;))
  37. **
  38. ** Revision V1.7
  39. ** --------------
  40. ** created on Mittwoch, 24.08.94 17:01:39  by  Kai Iske.   LogMessage :
  41. **  -*-  changed on Monday, 16.01.95 01:41:26  by  Kai Iske.   LogMessage :
  42. **   - Changed layout of Prefs program to standard Prefs type
  43. **     window. Except for "Create icons?" everything should
  44. **     be fine, now.
  45. **     (Suggested + Requested by : Georges Goncalves)
  46. **  -*-  changed on Montag, 16.01.95 01:19:59  by  Kai Iske.   LogMessage :
  47. **   - Added full featured AppIcon support.
  48. **     (Requested by : Georges Goncalves & Peter Källegren)
  49. **  -*-  created on Mittwoch, 24.08.94 17:01:39  by  Kai Iske.   LogMessage :
  50. **   - FIcon-Prefs requested any muimaster.library, even though
  51. **     V7 was minimum!
  52. **
  53. ** Revision V1.6
  54. ** --------------
  55. ** created on Tuesday, 31.05.94 00:36:05  by  Kai Iske.   LogMessage :
  56. **  -*-  changed on Freitag, 19.08.94 00:59:59  by  Kai Iske.   LogMessage :
  57. **   - Using ForceIcon you may even "SnapShot" Disk icons now.
  58. **     Use SnapShot and then select SAVE from the Prefs program
  59. **  -*-  changed on Donnerstag, 18.08.94 19:31:04  by  Kai Iske.   LogMessage :
  60. **   - No more quit requesters will be shown
  61. **     (Requested by : Bernhard Moellemann)
  62. **  -*-  changed on Donnerstag, 18.08.94 19:12:10  by  Kai Iske.   LogMessage :
  63. **   - You may now even enter relative coordinates (relative to
  64. **     Workbench Screen`s width/height) for the icon`s position.
  65. **     This is accomplished through negative values for
  66. **     IconX/IconY
  67. **     (Requested by : Bernhard Moellemann)
  68. **  -*-  changed on Donnerstag, 18.08.94 18:46:52  by  Kai Iske.   LogMessage :
  69. **   - IconPosition window is smaller now
  70. **     (Requested by : Bernhard Moellemann)
  71. **  -*-  created on Tuesday, 31.05.94 00:36:05  by  Kai Iske.   LogMessage :
  72. **   - Sort routine could create enforcer hits!
  73. **
  74. ** Revision V1.5
  75. ** --------------
  76. ** created on Wednesday, 13.04.94 15:15:29  by  Kai Iske.   LogMessage :
  77. **  -*-  changed on Tuesday, 24.05.94 15:02:04  by  Kai Iske.   LogMessage :
  78. **   - Width/Height for Drawer window were handled the
  79. **     wrong way. (Swapped)
  80. **     (Reported by : Juergen Zeschky)
  81. **  -*-  changed on Tuesday, 24.05.94 14:59:44  by  Kai Iske.   LogMessage :
  82. **   - The Drawer window wasn`t updated, when one changed the
  83. **     Integer gadgets
  84. **  -*-  changed on Tuesday, 24.05.94 14:58:44  by  Kai Iske.   LogMessage :
  85. **   - When opening the Position window, it`s position was always
  86. **     set to the position which was specified when the EditEntry
  87. **     window was opened, thus no intermediate changes were
  88. **     reflected. Same applied to the Drawer window
  89. **     (Reported by : Michael 'Mick' Hohmann)
  90. **  -*-  changed on Wednesday, 13.04.94 15:25:11  by  Kai Iske.   LogMessage :
  91. **   - Added note about AmiCDROM 1.9 to the docs
  92. **     (Suggested by : Manuel Fischer)
  93. **  -*-  changed on Wednesday, 13.04.94 15:21:25  by  Kai Iske.   LogMessage :
  94. **   - Added note to docs about disks not containing a Disk.info
  95. **     file. READ THIS!
  96. **  -*-  created on Wednesday, 13.04.94 15:15:29  by  Kai Iske.   LogMessage :
  97. **   - Position window wasn`t moved, when user changed the
  98. **     contents of the integer gadgets (IconX/IconY)
  99. **
  100. ** Revision V1.4
  101. ** --------------
  102. ** created on Saturday, 19.02.94 01:27:31  by  Kai Iske.   LogMessage :
  103. **  -*-  changed on Thursday, 24.03.94 16:43:23  by  Kai Iske.   LogMessage :
  104. **   - EditEntry window`s cycle gadgets (IconPos, UseIcon etc..)
  105. **     are volume type senstive now, ie Ignore,Use,Inherit will be
  106. **     available when Type is set to "Volume",  while Ignore and
  107. **     Use are available when editing a device.
  108. **     (Suggested by : Christopher A. Wichura)
  109. **  -*-  changed on Wednesday, 23.03.94 12:49:17  by  Kai Iske.   LogMessage :
  110. **   - Inheritance of device settings is individually controlled
  111. **     for every entry through a cycle gadget, so that you may
  112. **     tell which items to inherit and which to ignore, or use.
  113. **     (Requested by : Christopher A. Wichura)
  114. **  -*-  changed on Tuesday, 22.03.94 23:19:46  by  Kai Iske.   LogMessage :
  115. **   - You may now force Window size/position and flags
  116. **     (display flags)
  117. **     (Requested by : Christopher A. Wichura)
  118. **  -*-  changed on Tuesday, 22.03.94 18:32:58  by  Kai Iske.   LogMessage :
  119. **   - The ListViews will show volumes in white color now, so
  120. **     that you may distinguish whether an entry is a Volume or a
  121. **     Device
  122. **  -*-  changed on Saturday, 19.03.94 17:58:56  by  Kai Iske.   LogMessage :
  123. **   - Diskobject for Iconify Gadget will obtained from the
  124. **     program`s icon
  125. **  -*-  changed on Saturday, 19.03.94 17:52:54  by  Kai Iske.   LogMessage :
  126. **   - Added online-help support
  127. **  -*-  changed on Saturday, 19.03.94 17:17:15  by  Kai Iske.   LogMessage :
  128. **   - Made behaviour of obtaining settings from a device entry
  129. **     for a volume entry switchable from ToolTypes/commandline
  130. **     options.
  131. **  -*-  changed on Saturday, 19.03.94 16:24:58  by  Kai Iske.   LogMessage :
  132. **   - ForceIcon will use memory pools for allocations now.
  133. **  -*-  changed on Saturday, 19.03.94 16:23:41  by  Kai Iske.   LogMessage :
  134. **   - For volumes, for which some flags aren`t set (like IconPos or
  135. **     UseIcon) ForceIcon will take the settings of the device
  136. **     the volume resides in as long as it is a) defined and b)
  137. **     the missing flag is set there.
  138. **     (Suggested by : Christopher A. Wichura)
  139. **  -*-  changed on Saturday, 19.03.94 15:43:18  by  Kai Iske.   LogMessage :
  140. **   - DiskChanges on startup protected by Semaphore
  141. **     (Suggested by: Christopher A. Wichura)
  142. **  -*-  changed on Saturday, 19.03.94 15:42:06  by  Kai Iske.   LogMessage :
  143. **   - LoadPrefs() protected by Semaphore
  144. **     (Suggested by: Christopher A. Wichura)
  145. **  -*-  changed on Thursday, 17.03.94 18:24:44  by  Kai Iske.   LogMessage :
  146. **   - If you quit the EditEntry window using "OK", ForceIcon_Prefs
  147. **     will send a disk change to the device in question...
  148. **   - Improved semaphore locking mechanism. Chris didn`t like it,
  149. **     so I changed it, even though I can`t see his point (for now)
  150. **     (Requested by : Christopher A. Wichura)
  151. **  -*-  changed on Wednesday, 16.03.94 22:23:30  by  Kai Iske.   LogMessage :
  152. **   - Added FlushMemory switch/tooltype
  153. **   - Only devices in the list (or their volumes) will get a 
  154. **     disk change on startup now
  155. **     (Requested by : Christopher A. Wichura)
  156. **  -*-  changed on Wednesday, 16.03.94 22:22:13  by  Kai Iske.   LogMessage :
  157. **   - Added server prefs concept. ForceIcon is a simple program
  158. **     now, w/o any GUI. A seperate Prefs Editor has been added
  159. **     (using MUI) to configure ForceIcon.
  160. **   - Rearrangement of List after editing an entry didn`t work
  161. **  -*-  changed on Saturday, 12.03.94 19:32:33  by  Kai Iske.   LogMessage :
  162. **   - Again changed the routine for getting the list of available
  163. **     volumes/devices
  164. **     (Suggestions by : Ralph Babel)
  165. **  -*-  changed on Saturday, 12.03.94 19:31:48  by  Kai Iske.   LogMessage :
  166. **   - Didn`t convert a string to upper-case before calling
  167. **     ParsePatternNoCase(). This has to be done for OS 37
  168. **     Systems.
  169. **     (Reported by : Christopher A. Wichura)
  170. **  -*-  changed on Saturday, 12.03.94 14:23:12  by  Kai Iske.   LogMessage :
  171. **   - Added special code to check for block mounted devices.
  172. **     (Supplied by : Christopher A. Wichura. Thanks Chris)
  173. **  -*-  changed on Thursday, 10.03.94 14:23:11  by  Kai Iske.   LogMessage :
  174. **   - When adding a new item to the list, another entry could
  175. **     loose the settings for the IconPos gadget. This was due to a
  176. **     bug in the sorting routine. Fixed
  177. **     (Reported by : Mark 'TheMug' Rose)
  178. **  -*-  changed on Thursday, 10.03.94 14:02:35  by  Kai Iske.   LogMessage :
  179. **   - Patterns for Volumes and Devices supported now
  180. **  -*-  changed on Sunday, 06.03.94 17:38:53  by  Kai Iske.   LogMessage :
  181. **   - When launched ForceIcon will now make all connected disks
  182. **     disk change, in order to reposition the icons. This way you
  183. **     may launch ForceIcon from within your WBStartUp now
  184. **     (Requested by : Henning Schmiedehausen)
  185. **  -*-  changed on Sunday, 06.03.94 17:20:31  by  Kai Iske.   LogMessage :
  186. **   - Enforcer Hit for illegal Locks fixed
  187. **     (Changed by : Henning Schmiedehausen)
  188. **   - Windows will pop up on default PubScreen now
  189. **     (Changed by : Henning Schmiedehausen)
  190. **  -*-  changed on Sunday, 27.02.94 17:52:56  by  Kai Iske.   LogMessage :
  191. **   - More security checks when removing patches
  192. **     (Requested/Changed by : Henning Schmiedehausen)
  193. **  -*-  created on Saturday, 19.02.94 01:27:31  by  Kai Iske.   LogMessage :
  194. **   - ForceIcon didn`t clone all of the window`s flags
  195. **   - For some icon-substitutes, ForceIcon didn`t clone anything
  196. **     (Reported by : Michael 'Mick' Hohmann)
  197. **
  198. ** Revision V1.3
  199. ** --------------
  200. ** created on Sunday, 02.01.94 15:31:32  by  Kai Iske.   LogMessage :
  201. **   - Code cleanup
  202. **   - Partial rewrite of docs
  203. **
  204. ** Revision V1.2
  205. ** --------------
  206. ** created on Tuesday, 07.12.93 18:10:09  by  Kai Iske.   LogMessage :
  207. **   - Entries may be copied now
  208. **
  209. ** Revision V1.1
  210. ** --------------
  211. ** created on Tuesday, 02.11.93 23:11:14  by  Kai Iske.   LogMessage :
  212. **  -*-  changed on Saturday, 27.11.93 02:12:59  by  Kai Iske.   LogMessage :
  213. **   - Recompiled using SAS 6.50
  214. **  -*-  changed on Saturday, 20.11.93 18:14:21  by  Kai Iske.   LogMessage :
  215. **   - ForceIcon will adopt the orig. window position and size now.
  216. **     (Suggested by : Michael 'Mick' Hohmann and me)
  217. **  -*-  changed on Saturday, 20.11.93 18:03:08  by  Kai Iske.   LogMessage :
  218. **   - Icons weren`t positions as set with the Position window.
  219. **     (Reported by : Michael 'Mick' Hohmann)
  220. **   - Misleading explanation removed from docs
  221. **     (Reported by : Michael 'Mick' Hohmann)
  222. **  -*-  changed on Saturday, 20.11.93 17:33:51  by  Kai Iske.   LogMessage :
  223. **   - The X/Y coordinates may be set manually, now.
  224. **     (Requested by : Michael 'Mick' Hohmann)
  225. **  -*-  changed on Saturday, 20.11.93 17:24:20  by  Kai Iske.   LogMessage :
  226. **   - Edit Entry window`s gadget used 'I' twice
  227. **     (Reported by : Michael 'Mick' Hohmann)
  228. **  -*-  changed on Thursday, 11.11.93 18:43:27  by  Kai Iske.   LogMessage :
  229. **   - You may now tell ForceIcon not to patch the position, but
  230. **     rather let WB chose a good place. (Good when importing
  231. **     volumes via network)
  232. **  -*-  changed on Tuesday, 02.11.93 23:23:00  by  Kai Iske.   LogMessage :
  233. **   - ListView gadgets weren`t adjusted for OS 2.x. - Should check
  234. **     for OS 2.x sometime ;)
  235. **     (Reported by : Bernhard Moellemann)
  236. **   - Changed needed Versions of some libraries from 37 to 36
  237. **  -*-  created on Tuesday, 02.11.93 23:11:14  by  Kai Iske.   LogMessage :
  238. **   - If there wasn`t a filename for the Icon-File the
  239. **     FileRequester sometimes showed a weird Drawer-Name
  240. **     (Reported by : Dirk Federlein)
  241. **
  242. ** Revision V1.0
  243. ** --------------
  244. ** created on Wednesday, 20.10.93 17:19:27  by  Kai Iske.   LogMessage :
  245. **  -*-  changed on Thursday, 28.10.93 17:35:28  by  Kai Iske.   LogMessage :
  246. **   - Suggestions for device dependancy by Ralph Babel
  247. **   - Bug "found" by Ralph Babel
  248. **   - Pos window used to open on default pubscreen, not on WB.
  249. **     (Reported by : Bernhard Moellemann)
  250. **  -*-  created on Wednesday, 20.10.93 17:19:27  by  Kai Iske.   LogMessage :
  251. **     --- Initial release ---
  252. **
  253. *********************************************************************************/
  254. #define REVISION "1.8"
  255. #define REVDATE  "26.01.95"
  256. #define REVTIME  "16:09:33"
  257. #define AUTHOR   "Kai Iske"
  258. #define VERNUM   1
  259. #define REVNUM   8
  260.  
  261.  
  262. /**********************************************************************/
  263. /*                   Prototype for serial debugging                   */
  264. /**********************************************************************/
  265. void KPrintF(char *, ...);
  266.  
  267.  
  268.  
  269. /**********************************************************************/
  270. /*                   Prototypes for Pool functions                    */
  271. /**********************************************************************/
  272. APTR    __asm AsmCreatePool(register __d0 ULONG, register __d1 ULONG, register __d2 ULONG, register __a6 struct ExecBase *);
  273. void    __asm AsmDeletePool(register __a0 APTR, register __a6 struct ExecBase *);
  274. APTR    __asm AsmAllocPooled(register __a0 APTR, register __d0 ULONG, register __a6 struct ExecBase *);
  275. void    __asm AsmFreePooled(register __a0 APTR, register __a1 APTR, register __d0 ULONG, register __a6 struct ExecBase *);
  276.  
  277.  
  278.  
  279. /**********************************************************************/
  280. /*                              Defines                               */
  281. /**********************************************************************/
  282. enum{
  283.     ERR_OPEN,
  284.     ERR_NOMEM,
  285.     ERR_NOTALL,
  286.     ERR_ABOUT,
  287.     ERR_EXISTS,
  288.     ERR_PATCH,
  289.     ERR_SNAPEDICON,
  290.     ERR_NO_APP,
  291.     ERR_OLDFICON,
  292.     ERR_APPICONSPATCHED
  293. };
  294.  
  295.  
  296.  
  297. /**********************************************************************/
  298. /*                        Nodes for Guide file                        */
  299. /**********************************************************************/
  300. #define    NODE_MAIN        "Usage"
  301. #define    NODE_LEFT        "Left part"
  302. #define    NODE_RIGHT        "Right part"
  303. #define    NODE_EDIT        "EditEntry"
  304. #define    NODE_MANUAL        "ManualInput"
  305.  
  306.  
  307.  
  308. /**********************************************************************/
  309. /*                    Define for our special entry                    */
  310. /**********************************************************************/
  311. #define    FICON_APPICON        0x42
  312.  
  313.  
  314.  
  315. /**********************************************************************/
  316. /*                    This is our rendezvous Port                     */
  317. /**********************************************************************/
  318. struct FIconSema
  319. {
  320.     struct    SignalSemaphore    FIconSema;        // Our semaphore
  321.  
  322.     ULONG            UseCount;        // Use count of semaphore
  323.     char    Name[44];                // Name of semaphore
  324.  
  325.     struct    List        VolumeList;        // List of volumes
  326.     struct    Task        *ServerTask;        // Address of ServerTask
  327.     struct    Task        *PrefsTask;        // Address of PrefsTask
  328.  
  329.     APTR            FIconPool;        // Pool for allocations
  330.  
  331.     UWORD            FlushMemory;        // Flushmemory ???
  332.     UWORD            ObtainFromDev;        // Get settings from device when not set for volume ???
  333.  
  334.     struct    List        AppIconList;        // List for AppIcons
  335. };
  336.  
  337.  
  338.  
  339.  
  340.  
  341. /**********************************************************************/
  342. /*                         Structure defines                          */
  343. /**********************************************************************/
  344. struct VolEntry
  345. {
  346.     struct    Node        Link;
  347.     char            VolName[130];
  348.     char            IconName[256];
  349.     WORD            Left;
  350.     WORD            Top;
  351.     UWORD            UseAlt;
  352.     UWORD            IconPos;
  353.     UWORD            UseWin;
  354.     WORD            WinX;
  355.     WORD            WinY;
  356.     WORD            WinWidth;
  357.     WORD            WinHeight;
  358.     UWORD            UseFlags;
  359.     UWORD            WinFlags;
  360.     UWORD            Pad[25];        // For future expansions
  361.     WORD            LeftEdge;        // These are only used during runtime
  362.     WORD            TopEdge;
  363.     WORD            Width;
  364.     WORD            Height;
  365.     LONG            CurrentX;
  366.     LONG            CurrentY;
  367.     ULONG            Flags;
  368.     UWORD            ViewMode;
  369.     struct    MsgPort        *DriverTask;
  370.     struct    AppIcon        *AppIconAdr;
  371.     struct    DiskObject    *DObj;
  372.  
  373. };
  374.  
  375.  
  376.  
  377. /**********************************************************************/
  378. /*                        Defines for windows                         */
  379. /**********************************************************************/
  380. enum {
  381.     ID_DUMMY,
  382.  
  383.     ID_USEDLIST,            // Main window (Volumes)
  384.     ID_EDITENTRY,
  385.     ID_COPYENTRY,
  386.     ID_REMOVEENTRY,
  387.     ID_AVAILLIST,
  388.     ID_ADDENTRY,
  389.     ID_ADDENTRYMAN,
  390.     ID_RESCANLIST,
  391.     ID_APPUSEDLIST,            // Main window (AppIcons)
  392.     ID_APPEDITENTRY,
  393.     ID_APPCOPYENTRY,
  394.     ID_APPREMOVEENTRY,
  395.     ID_APPAVAILLIST,
  396.     ID_APPADDENTRY,
  397.     ID_APPADDENTRYMAN,
  398.     ID_APPRESCANLIST,
  399.     ID_OPEN,
  400.     ID_SAVEAS,
  401.     ID_SAVE,
  402.     ID_USE,
  403.     ID_ABOUT,
  404.     ID_HIDE,
  405.     ID_QUIT,
  406.     ID_RESET,
  407.     ID_LASTSAVED,
  408.     ID_RESTORE,
  409.  
  410.     ID_EDITOK,            // Edit window (volumes)
  411.     ID_EDITCANCEL,
  412.     ID_ICONX,
  413.     ID_ICONY,
  414.     ID_POSITION,
  415.     ID_DRAWER,
  416.     ID_WINX,
  417.     ID_WINY,
  418.     ID_WINWIDTH,
  419.     ID_WINHEIGHT,
  420.  
  421.     ID_APPEDITOK,            // Edit window (AppIcons)
  422.     ID_APPEDITCANCEL,
  423.     ID_APPICONX,
  424.     ID_APPICONY,
  425.     ID_APPPOSITION,
  426.  
  427.     ID_MANOK,            // Man window (Volumes)
  428.     ID_MANCANCEL,
  429.  
  430.     ID_APPMANOK,            // Man window (AppIcons)
  431.     ID_APPMANCANCEL
  432. };
  433.  
  434.  
  435.  
  436.  
  437. /**********************************************************************/
  438. /*                         Modes for settings                         */
  439. /**********************************************************************/
  440. enum {
  441.     MODE_IGNORE,
  442.     MODE_USE,
  443.     MODE_INHERIT
  444. };
  445.